import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const routes = [
    {
        path: '/',
        redirect: '/xchat',
    },
]

const vueRouter = new Router({
    //使用history会导致子项目访问有问题（无法直接通过子项目url访问,报错：Vue is not defined）
    mode: 'hash',
    scrollBehavior: () => ({
        x: 0,
        y: 0,
    }),
    routes: routes
})

vueRouter.beforeEach((to, from, next) => {
    next()
})

export default vueRouter

